<template>
    <div class="content">
        <!-- 弹出框 -->
        <div class="popup" v-show="isclose">
            <div class="popup-img" @click="showbigimg">
                <img :src="imgData.images" />
            </div>
            <div class="popup-info">
                <h3>{{ imgData.title }}</h3>
                <div class="popup-info-content">
                    <div class="popup-info-content-left">
                        <div class="left-text">
                            价格：<span>{{ imgData.price }}</span>
                        </div>
                        <div class="left-text">
                            类型：<span>{{ imgData.size }}</span>
                        </div>
                        <div class="scan-code">
                            <img src="/static/Exhibition_img/QRcode.png" />
                            <p>扫码购买</p>
                        </div>
                    </div>
                    <div class="popup-info-content-right">
                        <p>
                            {{ imgData.description }}
                        </p>
                    </div>
                </div>
            </div>
            <div class="close" @click="close"><span>&times;</span></div>
        </div>
        <!-- 图片变大 -->
        <div class="bigimg" v-show="isbigimg">
            <div class="imglay" @click="closebigimg"></div>
            <div class="bigimg-img">
                <img :src="imgData.images" />
                <div class="closebigimg" @click="closebigimg"><span>&times;</span></div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: '',
    data() {
        return {
            isclose: false, //弹出框
            isbigimg: false,
            imgData: {},
        }
    },
    methods: {
        // 关闭图片放大
        closebigimg() {
            this.isbigimg = false
            this.isclose = true
        },
        //关闭弹出框
        close() {
            this.isclose = false
            this.$parent.showSidebar()
        },
        showbigimg() {
            this.isbigimg = true
            this.isclose = false
        },
    },
    props: ['bigimgData'],
    watch: {
        bigimgData(n, o) {
            console.log(n, o)
            this.imgData = n
            this.isclose = true
        },
    },
}
</script>

<style lang="less" scoped>
.popup {
    width: 25rem;
    max-height: 90%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    .popup-img {
        width: 100%;
        text-align: center;
        background: #fff;
        padding: 0.9375rem;
        box-sizing: border-box;
        border-style: solid solid none;
        border-color: #eee;
        border-width: 2px;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        img {
            width: 100%;
        }
    }
    .popup-info {
        width: 100%;
        background: #6a638c;
        // opacity: 0.5;
        color: #fff;
        h3 {
            margin: 0;
            font-size: 1.125rem;
            color: #fff;
            font-weight: 550;
            padding: 0.9375rem;
        }
        .popup-info-content {
            width: 100%;
            display: flex;
            margin-bottom: 0.9375rem;
            .popup-info-content-left {
                padding: 0 0.9375rem;
                width: 50%;
                .left-text {
                    color: #cbcbcb;
                    font-size: 0.875rem;
                    span {
                        color: #fff;
                        font-weight: 550;
                    }
                }
                .scan-code {
                    display: flex;
                    align-items: center;
                    margin-top: 0.9375rem;
                    img {
                        width: 3.4375rem;
                        height: 3.4375rem;
                        background: #ddd;
                        box-shadow: 2px 2px 3px #333;
                        margin-right: 0.625rem;
                    }
                    p {
                        margin: 0;
                        padding: 0;
                        text-align: center;
                        font-size: 0.625rem;
                        color: #cbcbcb;
                        writing-mode: tb-rl;
                    }
                }
            }
            .popup-info-content-right {
                width: 50%;
                height: 7.5rem;
                margin-right: 0.9375rem;
                border: 1px solid #eee;
                background-repeat: no-repeat;
                background-position: 0 0;
                border-radius: 5px;
                padding: 5px 5px 0 5px;
                overflow: auto;
                overflow-y: auto;
                &::-webkit-scrollbar {
                    /*滚动条整体样式*/
                    width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
                    height: 1px;
                }
                &::-webkit-scrollbar-thumb {
                    /*滚动条里面小方块*/
                    border-radius: 0.625rem;
                    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
                    background: #999999;
                }
                &::-webkit-scrollbar-track {
                    /*滚动条里面轨道*/
                    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
                    border-radius: 0.625rem;
                    background: #fff;
                }
                p {
                    font-size: 0.625rem;
                }
            }
        }
    }
    .close {
        width: 2.1875rem;
        height: 2.1875rem;
        text-align: center;
        position: absolute;
        bottom: -3.75rem;
        left: 50%;
        color: #999999;
        transform: translateX(-50%);
        border-radius: 50%;
        background: #fff;
        border: 1px solid #999999;
        span {
            font-weight: 600;
            font-size: 1.5rem;
            line-height: 1.9375rem;
        }
    }
}
.bigimg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    .imglay {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        cursor: pointer;
    }
    .bigimg-img {
        height: 80%;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        img {
            // width: 100%;
            height: 100%;
        }
        .closebigimg {
            width: 2.1875rem;
            height: 2.1875rem;
            text-align: center;
            position: absolute;
            bottom: -3.75rem;
            left: 50%;
            color: #999999;
            transform: translateX(-50%);
            border-radius: 50%;
            background: #fff;
            border: 1px solid #999999;
            span {
                font-weight: 600;
                font-size: 1.5rem;
                line-height: 1.9375rem;
            }
        }
    }
}
</style>